Skip to content

Add reusable url Zod schema for URL props#581

Merged
seveibar merged 1 commit intomainfrom
codex/create-reusable-zod-url-type
Feb 4, 2026
Merged

Add reusable url Zod schema for URL props#581
seveibar merged 1 commit intomainfrom
codex/create-reusable-zod-url-type

Conversation

@seveibar
Copy link
Contributor

@seveibar seveibar commented Feb 4, 2026

Motivation

  • Imported static URLs can sometimes be objects like { default: "..." } due to bundlers, so validation should be tolerant and normalize those to strings before type-checking.

Description

  • Add a shared url Zod schema in lib/common/url.ts that preprocess-es values by unwrapping { default: ... } and then validates as z.string().
  • Replace direct z.string() usages for URL-like props with the new url schema in lib/common/cadModel.ts, lib/components/cadmodel.ts, lib/common/layout.ts, lib/components/group.ts, and lib/platformConfig.ts, and update cadmodelProps to accept url.
  • Regenerate the component types documentation so the new url schema is reflected in generated/COMPONENT_TYPES.md.

Testing

  • Ran the generation scripts bun scripts/generate-component-types.ts, bun scripts/generate-manual-edits-docs.ts, bun scripts/generate-readme-docs.ts, and bun scripts/generate-props-overview.ts, and they completed successfully.
  • Ran bunx tsc --noEmit to type-check the project and it succeeded.
  • Ran bun run format to format files and it completed successfully.

Codex Task

@seveibar seveibar merged commit fcc5dbb into main Feb 4, 2026
5 checks passed
@tscircuitbot
Copy link
Contributor


Thank you for your contribution! 🎉

PR Rating: ⭐⭐⭐
Impact: Major

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants